package common

import "net/http"

type HttpResponseFormat struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type HttpPaginationFormat struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
	Total   int64       `json:"total"`
	Current int         `json:"current"`
	Size    int         `json:"pageSize"`
}

func SuccessResponse(data interface{}) HttpResponseFormat {
	return HttpResponseFormat{Code: 200, Msg: "success", Data: data}
}
func SuccessPagination(data interface{}, size, current int, total int64) HttpPaginationFormat {
	return HttpPaginationFormat{Code: 200, Msg: "success", Data: data, Total: total, Current: current, Size: size}
}
func ErrorResponse(Msg string) (int, HttpResponseFormat) {
	return http.StatusInternalServerError, HttpResponseFormat{Code: 500, Msg: Msg, Data: ""}
}
